Page({
  /**
   * 页面的初始数据
   */
  data: {
    menuDay:[
      {
        "id":0,
        "title":"星期一",
      },
      {
        "id":1,
        "title":"星期二",
      },
      {
        "id":2,
        "title":"星期三",
      },
      {
        "id":3,
        "title":"星期四",
      },
      {
        "id":4,
        "title":"星期五",
      },
      {
        "id":5,
        "title":"周六",
      },
      {
        "id":6,
        "title":"周日",
      }      
    ],
    //左侧的单前项
    leftNum:0,
    day:0
  },
  toDetail(e){
    // console.log(e.currentTarget.dataset.id)
    wx.navigateTo({
      url: '/pages/detail/detail?id=' + e.currentTarget.dataset.id,
    })
  },
  onLoad() {
    this.getActionList()
  },
  getActionList(){
    var that = this
    // console.log(that.data.menuDay[that.data.day].title)
    wx.cloud.database().collection('menu_comments').where({
      dayid: that.data.menuDay[that.data.day].title
    }).get({
      success(res){
        // console.log(res.data)
        var list = res.data
        that.setData({
          menuList : list  
        })
      }
    })
  },
  //左侧点击事件
  //当你想要获取某些数据，但又无从下手时，请考虑事件对象。
  leftClickFn(e){
    // console.log(e.currentTarget.dataset.myindex)
    this.setData({
      leftNum:e.currentTarget.dataset.myindex,
      day:e.currentTarget.dataset.myindex
    })
    this.getActionList()
  }
})